<template>
	<view class="uiwu uiwu-ios">
		<uiwu-list :loading="more">
			<view class="uiwu-list">
				<view class="uiwu-list-item uiwu-flex-space" v-for="(item,index) in listData" :key="index">
					<image src="/static/txwx.png" v-if="item.extract_type == 'weixin'" mode="widthFix"></image>
					<image src="/static/txyhk.png" v-else mode="widthFix"></image>
					<view class="in uiwu-flex-column">
						<text>提现到{{item.extract_type == 'weixin' ? '微信零钱' : '银行卡'}}</text>
						<text>{{uiwu.formatTimestamp(item.add_time * 1000)}}</text>
					</view>
					<view class="right uiwu-flex-column">
						<text>￥{{item.extract_price}}</text>
						<text>手续费￥{{item.service_fee}}</text>
						<text :class="item.status == -1 || item.status == 0 ? '' : 'active'">{{item.status == -1 ? '提现失败' : item.status == 0 ? '审核中' : '提现成功'}}</text>
					</view>
				</view>
			</view>
		</uiwu-list>
	</view>
</template>

<script setup lang="ts">
	import { onLoad } from '@dcloudio/uni-app';
	import { ref } from "vue";
	import { cashlist } from '@/api/api';
	import { uiwu } from '@/config/config';
	const listData = ref<Array<object>>([])
	const pageNum = ref<number>(1)
	const more = ref<string>('loading');
	const isLock = ref<boolean>(true)
	const getcashlist = async (mack:boolean=false) : Promise<any> => {
		if(!mack) pageNum.value = 1
		const { data:{ data , total }} = await cashlist({
			page:pageNum.value
		})
		console.log(data);
		isLock.value = true
		uiwu.setlist({
			isMore:mack,
			listData,
			total,
			listRow:data,
			more,
			pageNum
		})
	}
	onLoad(()=>{
		getcashlist()
	})
</script>

<style lang="scss">
	page{
		background-color: #e6e6e6;
	}
	.uiwu{
		padding-top: 20rpx;
	}
	.uiwu-list{
		background-color: #fff;
		padding: 0 24rpx;
		&-item{
			padding: 20rpx 0;
			border-bottom: 1rpx solid #e6e6e6;
			image{
				width: 60rpx;
				margin-right: 16rpx;
			}
			.in{
				flex: 1;
				text{
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;
					&:nth-child(1){
						font-size: 28rpx;
						font-weight: bold;
						color: #231815;
						margin-bottom: 4rpx;
					}
				}
			}
			.right{
				text{
					text-align: right;
					font-size: 32rpx;
					font-weight: 500;
					color: #231815;
					&:nth-child(2){
						font-size: 24rpx;
						font-weight: 400;
						color: #999999;
						margin: 5rpx 0;
					}
					&:nth-child(3){
						font-size: 24rpx;
						font-weight: 500;
						color: #FF5100;
						&.active{
							color: #5BB431;
						}
					}
				}
			}
		}
	}
</style>
